package com.xxg.renrenorder.util;

import org.springframework.stereotype.Component;

/**
 * 订单ID生成器
 *
 * @author xxg
 * @date 2020/11/17
 */
@Component
public class OrderIdGenerator {
    private final IdWorker idWorker;

    public OrderIdGenerator() {
        this.idWorker = new IdWorker(0, 0);
    }

    /**
     * 生成订单ID
     *
     * @return 订单ID
     */
    public long createId() {
        return idWorker.nextId();
    }
}
